Saturday, June 15, 2002

Want to take programming class with me this summer. Well I am learning C and have decided to put up my notes on each chapter read. I am a week and a half into the class, so I will add chapters 1 day at a time, till I get caught up so as not to overwhelm you. The notes are from A First Book of Ansi C third edition. by Gary J Bronson. We basically read the book, watch some videos, take part in threaded instructions, and turn in code, (with two test during the semester. If you are using the RSS Feed come to the site (http://dr_bob.blogspot.com/) to take a look. Any way, have fun you all.



Excuse the numbering the HTML is from Microsoft Word wich does not do a great job on HTML code.

Chapter 1 - Getting Started






    1. Introduction to Programming




A computer is a machine. Like any other machine it needs to be told what to do and that is called a program. All programs do basically the same thing, input data, manipulate the data and output the data. Why are there so many programming languages? There are so many because each has it own specialty niche.






  • Science and engineering: Fortran

  • Business Applications: COBOL

  • Teaching programming: Basic and Pascal

  • Structured programming: C



In order to write a program a programmer has to know how to write a step by step sequence of instructions to perform a computation. This is known as an algorithm. You must decide on one way to solve the problem. To simplify this process, begin by writing out the steps in plain English. This is referred to as pseudo code. Math equations are called formulas. Instead of pseudo code a pictorial representations is sometimes used. This is referred to as a flow chart.



Our next step would be to change the algorithm into a program (coding). Once coded it needs to be converted to machine language so the computer can use it (translated). In C we use a compiler to covert all the code to an executable file. Other programming languages use an interpreter and convert one line if code at a time as needed.



 





    1. Introduction to Modularity




Just as a building does not happen, neither do programs. They require planning. The structure is the program's overall construction. In constructing modular programming we will need to use modules. Each has a specific task in taking in, processing, and outputting data. In C, these modules are called functions.


Functions should be given good name (identifiers) that reflects what they really do. They need to follow the following rules:






  1. First character MUST be letter or underscore (_)




  1. Second and all following must be alphanumeric or underscore (_)

  2. Cannot be a reserve word

  3. No more than 31 characters (compilers may vary on this)




Each C program has a function named main where all other functions are called. It, as all functions start with a function header line. This tells the following information:






  1. What type of data is returned

  2. Name of the function

  3. Type of data, if any, is sent into the function




Here is an example:



int main()



in this example, int is integer, the type of value that will be returned, main is the name of the function, and () has the information that is being sent into the program. Since the ( ) are empty, there is no information being sent in. Any information (arguments) sent in would be in-between the ( ). After this will follow curly braces {} with the program between them. All statements insode the {} must have a semicolon at the end (;).



 



1.3 The printf() function


To put output ot a screen, the printf() function needs to be used. Anything that is between the ( ) will be output to the screen. It should be in " " in the ( ).



Comments are important to all programs as they tell you information on what was done, and why. They can be added to your code by putting them in-between /* and */. All comments will not compile when it comes time to compile the program. Do not nest one set of comments inside another set.



To use the printf() function, you will need to add a preprocessor line. This will include pre-built functions. For the printf() function we will use stdio.h. It is added before the main() function like this:



#include <stdio.h>



It is called a header file because of its locations and does not need to include a ; at the end.



printf() uses the \ character to do special things. One of these is \n which does a new line. The \ is called an escape character.



 





    1. Programming Style




While there is no specific way to write a program it is a good idea to make it readable. Lines should be indented as needed to express clarity. The compiler will ignore most white-space (space between characters). Also one should use comments liberally to help you and others what was being done in the program.



 






    1. Top Down Development




Five steps in program development






  1. Determine what the output is that the program needs to produce

  2. Determine what the inputs are to be.

  3. Design the program






    1. Select the algorithm for transferring the input to the output

    2. Check algorithm by hand with specific values





  1. Code in C.

  2. Test with selected data.


  3. Steps 1 & 2 are the analysis phase.


    Step 3 is the design phase.


    Step 4 is the coding phase.


    Step 5 is the testing phase.






    1. Common Programming Errors







    1. Omitting the () after the main function

    2. Omitting or not typing correctly the { at the start of the program

    3. Omitting or not typing correctly the } at the start of the program

    4. Misspelling a function name

    5. Forgetting to close the message in a printf() function with a "

    6. Omitting a semicolon (;) at the end of a statement

    7. Forgetting the \n to indicate a new line.






One major mistake that all new programmers make is that the start to code before they know what the program is supposed to do, what algorithms are needed, and a clear understanding of what is to be done. Take time from the start and you will get it right.


Microsoft Shipments Infected With Nimda One really has to laugh at this, the company that wants to impress us with how secure they want to make our systems.

Mercury News | 06/15/2002 | Many believe Jesus sinned on Earth, study reports Two quick thoughts 1) why is this under the entertainment side of the newspaper side of the website (look at the link), and 2) Because 25% of the people think this way does that make it true. Guess what? If 99% belived Jesus sined, would that make it true? I belive He lived a sinless life for me. And that is all that really matters. He died for me, and I am have eternal life in heave for it. How about you. Write me at drbobm@yahoo.com to discuss it!

Friday, June 14, 2002

BBC News | NEWSNIGHT | Hacker watches Nato spy pictures HMMMMM why have we not head about this here in the states. Can we all get together and buy our government a cable descramble, and then get Ted Turner to pitch in for scrambling equipment. What next?

New Yahoo! This is the future for Yahoo. What do you think. Maybe you should write your opinion. As one person said the directory is below the fold. I do not care for that, how about you.

F-Secure Computer Virus Information Pages: Frethem Moving up the charts with speed. Please be careful with emails promising you nice desktop themes. Update your antivirus programs please.

First Reported JPEG Virus Found Not to be too worried about this one. It is more theory than fact. Do me a favor people, practice Safe Hex will you! Do not detach or download any thing that you were not really expectecting. And if a program sounds too good to be true, it probally is.

Microsoft Warns Again on MSN Chat Flaw If you use MSN Instant Messenger please follow the links. It is possible to use the Chat feature and not know that you were. There is a serious hole and it needs to be closed. If you did it before, do it again, this is a diffrent hole.

What Do You Want to Patch Today? You know, I think the title says it all. Do I need to say any more?

Tuesday, June 11, 2002

A few days late, but here is the latest Virus report from Trend Antivirus.


*********************************************************************
TREND MICRO WEEKLY VIRUS REPORT

(by TrendLabs Global Antivirus and Research Center)
*********************************************************************
------------------------------------------------------------------------
Date: June 7, 2002
------------------------------------------------------------------------
To read an HTML version of this newsletter, go to:
http://www.antivirus.com/trendsetter/virus_report/

Issue Preview:

1. Trend Micro Updates - Pattern File and Scan Engine Updates
2. Shakira Makes Her Debut - VBS_VBSWG.AQ (Medium Risk)
3. 10 Most Prevalent In-the-Wild Malware Surveyed by Trend Micro US
4. Trend Micro PC-cillin 2002 Now Available


NOTE: Long URLs may break into two lines in some mail readers.
Should this occur, please cut and paste the URL in your browser.

************************************************************************

1. Trend Micro Updates - Pattern File and Scan Engine Updates
------------------------------------------------------------------------
PATTERN FILE: 295 http://www.antivirus.com/download/pattern.asp
SCAN ENGINE: 6.150 http://www.antivirus.com/download/engines/

2. Shakira Makes Her Debut - VBS_VBSWG.AQ (Medium Risk)
------------------------------------------------------------------------
On June 6, 2002 the risk level of VBS_VBSWG.AQ was upgraded from low
risk to medium risk, due to an increase in this worm's activity.

This destructive Visual Basic Script (VBScript) worm propagates using
Microsoft Outlook, and arrives in an email with the following:

Subject: Shakira's Pictures

Message Body: Hi :
i have sent the photos via attachment
have funn...

Attachment: ShakiraPics.jpg.vbs

Upon execution, it drops a file, SHAKIRAPICS.JPG.VBS, in the Windows
directory and then adds a registry entry that allows it to execute at
every Windows startup.

This worm also copies itself to all .VBS and .VBE files found in all
local and remote drives, effectively overwriting these infected files. If
floppy disks or Zip disks are present in the disk drives, this worm
attempts to infect these drives as well.

If you would like to scan your computer for VBS_VBSWG.AQ or thousands
of other worms, viruses, Trojans and malicious code, visit HouseCall,
Trend Micro's free online virus scanner at:
http://housecall.antivirus.com/

VBS_VBSWG.AQ is detected and cleaned by Trend Micro pattern file #292
and above.

For additional information about VBS_VBSWG.AQ please visit:
http://www.antivirus.com/vinfo/virusencyclo/default5.asp?VName=VBS_VBSWG.AQ

3. 10 Most Prevalent In-the-Wild Malware Surveyed by Trend Micro US
(week of: May 27, 2002 to June 2, 2002)
------------------------------------------------------------------------
1. WORM_KLEZ.H
2. WORM_KLEZ.E
3. JS_EXCEPTION.GEN
4. JS_NOCLOSE.E
5. WORM_BENJAMIN.A
6. VBS_LOVELETTR.AS
7. PE_NIMDA.A-O
8. WORM_YAHA.B
9. WORM_BADTRANS.B
10. PE_MAGISTR.A

4. Trend Micro PC-cillin 2002 - Antivirus, Anti-Hacker, & PDA Virus
Protection
------------------------------------------------------------------------
Trend Micro is pleased to announce the release of PC-cillin 2002.
PC-cillin 2002 provides award-winning protection against macro viruses,
Trojans,
and other malicious threats. An integrated personal firewall helps
secure
desktop computers against illegal access, ping attacks, and even port
scanning
for Internet-era protection. This complete antivirus strategy also
includes
security for Palm, Pocket PC, and EPOC devices.

BUY NOW: $39.95
http://www.trendmicro.com/pcc2002_wvr

If you already own PC-cillin, you may purchase an upgrade to PC-cillin
2002 for
just $19.95 at:
http://www.antivirus.com/pc-cillin/products/upgrade.htm

This pricing applies to customers in the U.S. and Canada only.

Monday, June 10, 2002

I have to appoligise to the fan I have reading this, that I have not updated it in a while. The past week has been quite diffrent in that I have had intense child care responsibilities (along with stepkids going to see dad leaving me and the kids while mom went to airport), mom also had woman's confrence to help plan and to attend this weekend, leaving our kids with me for about two days straight, and she had work start morning. Well, on top of that I started online classes at Rogers's State University . In the first half week we had one weeks worth of material to cover (actually two because it is a summer class). We will not settle in to normal class material coverage. Hopefully the stress level will go down. Keep me in your prayers.